package cn.com.user.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cabinet.service.ICabinetService;
import com.cabinet.service.dto.CabinetDto;

@Controller
@RequestMapping("/near")
public class NeatByCabinetController {
	
	@Autowired
	private ICabinetService iCabinetService;
	
	@RequestMapping("/by")
	public String RedirectNear(){	
		return "/nearby/nearby";
	}
	
	
	@RequestMapping("/list")
	@ResponseBody
	public List<CabinetDto> getCabintByNear(String lat,String lng,String cclass){	
		//String lat = "24.621337";
		//String lng = "118.072055";
		CabinetDto cDto = new CabinetDto();
		cDto.setcLat(lat);
		cDto.setcLng(lng);
		cDto.setcClass(cclass);
		cDto.setLimit(10);
		List<CabinetDto> cabinDtoList = iCabinetService.getCabinetByNear(cDto);

		return cabinDtoList;
	}

}
